/**
 * Copyright (C), 2013-2019, 中商惠民科技有限公司
 * FileName: 动态代理
 * FileName: 动态代理
 * Author:   Eilen
 * Date:     2019/4/25 13:25
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 **/
package com.algorithm.basic;

import java.lang.reflect.Proxy;

/**
 * 〈describe〉<br>
 * 〈〉
 *
 * @author Eilen
 * @create 2019/4/25
 * @since 1.0.0
 */
public class 动态代理 {

    public static void main(String[] args) {
        Fruits fruits = new Fruits();
        Object o = Proxy.newProxyInstance(FruitsFactory.class.getClassLoader(), new Class[]{FruitsFactory.class}, new DynamicProxyHandler(fruits));
        Fruits fruits1 = (Fruits) o;
        fruits1.apple();
        fruits1.banana();

    }
}
